<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    
<!DOCTYPE html>
<html class="no-js" lang="">
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>个人中心</title>
		<meta name="description" content="">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">		
		<link href="css/ticket.css" rel="stylesheet" />
		<!-- Layui CSS-->
		<link rel="stylesheet" href="layui/css/layui.css" />
		<!-- Bootstrap CSS -->
		<link rel="stylesheet" href="dependencies/bootstrap/css/bootstrap.min.css">
		<!-- FontAwesome CSS -->
		<link rel="stylesheet" href="dependencies/fontawesome/css/all.min.css">
		<!-- Site Stylesheet -->
		<link rel="stylesheet" href="assets/css/app.css">
		<!-- 新加 -->
		<link rel="stylesheet" href="css/mystylef.css">

		<style type="text/css">
			#myinfo{
				color: #ffd65b;
				margin-left:110px;
				font-size: 35px;
				font-family: 幼圆;	
			}
		</style>
	</head>

	<body class="sticky-header bg-accent">
		<div class="wrapper">
			<header class="header-wrapper header-wrapper--home">
				<div class="container">
					<!-- Logo link-->
					<div style="height: 40px;"></div>
					<a href='main-general.jsp' class="logo" style="margin-left: 50px;">
						<img alt='logo' src="themovieimg/logo.png" width="140px">
					</a>
					<img alt="" src="themovieimg/个人中心.png" width="250px" height="180px" style="margin-left:100px">
			</header>
			<section class="section-padding-equal-70">
				<div class="container">
					<div class="row">
						<div class="col-lg-3 sidebar-break-sm sidebar-widget-area mt-0">
							<div class="widget-bottom-margin widget-account-menu widget-light-bg">
								<h3 class="widget-border-title">菜单</h3>
								<ul class="nav nav-tabs flex-column" role="tablist">
									<li class="nav-item">
										<a class="nav-link active" data-toggle="tab" href="#dashboard" role="tab" aria-selected="true">个人信息</a>
									</li>
									<li class="nav-item">
										<a class="nav-link" data-toggle="tab" href="#my-listing" role="tab" aria-selected="false">我的订单</a>
									</li>
									<li class="nav-item">
										<a class="nav-link" data-toggle="tab" href="#my-favourite" role="tab" aria-selected="false">我的收藏</a>
									</li>
									<li class="nav-item">
										<a class="nav-link" data-toggle="tab" href="#my-ticket" role="tab" aria-selected="false">我的影票</a>
									</li>
									<li class="nav-item">
										<a class="nav-link" data-toggle="tab" href="#my-comment" role="tab" aria-selected="false">我的影评</a>
									</li>
								</ul>
							</div>
						</div>
						<!-- 个人信息 -->
						<div class="col-lg-9">
							<div class="tab-content">
								<div class="tab-pane fade show active" id="dashboard" role="tabpanel">
									<div class="myaccount-dashboard light-shadow-bg">
										<div class="light-box-content">
											<div class="media-box">
												<div class="item-img">
													<a href="javascript:;" onclick="updimg()"><img src="<%=session.getAttribute("userpic")%>" id="myimg" alt="avatar" width="100px" height="100px"></a>
												</div>
												<div class="item-content">
													<h3 class="item-title" id="un"></h3>
													<div class="item-email" id="ut"></div>
												</div>
												<div class="product-box-layout3">
													<div class="product-info">
														<div class="item-right">
															<div class="item-btn" id="layerDemo">
																<a id="upduserinfo" data-method="offset" data-type="auto" class="layui-btn">修改个人信息</a>
															</div>
														</div>
													</div>
												</div>
											</div>
											<div class="static-report">
												<h3 class="report-title">会员信息</h3>
												<div class="report-list">
													<div class="report-item">
														<label>等级:</label>
														<div class="item-value" id="memberlevel"></div>
													</div>
												</div>
												<div class="report-list">
													<div class="report-item">
														<label>会员积分:</label>
														<div class="item-value" id="memberintegral"></div>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>
								<!-- 我的订单 -->
								<div class="tab-pane fade" id="my-listing" role="tabpanel">
									<div class="myaccount-listing" id="orderlist"></div>
									<div id="demo6" align="center" style="background-color: white;height: 50px;border-radius: 5px;"></div>
								</div>
								<!-- 我的影票 -->
								<div class="tab-pane fade" id="my-ticket" role="tabpanel">
									<div class="myaccount-listing" id="ticketlist"></div>
									<div id="demo8" align="center" style="background-color: white;height: 50px;border-radius: 5px;"></div>
								</div>
								<!-- 我的收藏 -->
								<div class="tab-pane fade" id="my-favourite" role="tabpanel">
									<div class="myaccount-listing" id="collectionlist"></div>
									<div id="demo7" align="center" style="background-color: white;height: 50px;border-radius: 5px;"></div>
								</div>
								
								<!-- 我的影评 -->
								<div class="tab-pane fade" id="my-comment" role="tabpanel">
									<div class="myaccount-listing" id="commentlist"></div>
									<div id="demo9" align="center" style="background-color: white;height: 50px;border-radius: 5px;"></div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</section>
		</div>
		
		<!-- 修改用户信息 -->
		<div id="editFormDiv" style="display: none;padding: 35px 30px 0 0;" >
			<form class="layui-form" action="" lay-filter="example">
				<input type="hidden" name="userid" id="userId" lay-verify="title" autocomplete="off" readonly class="layui-input">
				<div class="layui-form-item">
					<label class="layui-form-label">用户名</label>
					<div class="layui-input-block">
						<input type="text" name="username" id="userName"
							lay-verify="title" autocomplete="off" placeholder="请输入用户名"
							class="layui-input">
						<span id="tishi1"></span>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">电话</label>
					<div class="layui-input-block">
						<input type="text" name="usertel" id="userTel" lay-verify="title"
							autocomplete="off" placeholder="手机号码" class="layui-input">
						<span id="tishi"></span>
					</div>
				</div>
				<div class="layui-form-item" pane="">
					<label class="layui-form-label">改密码</label>
					<div class="layui-input-block">
						<input type="radio" name="updpwd" id="yes" lay-filter="pwdRadio" value="1" title="是" >
      					<input type="radio" name="updpwd" id="no" lay-filter="pwdRadio" value="0" title="否" checked="">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">原密码</label>
					<div class="layui-input-block" >
						<input type="password" name="oldpwd" id="oldPwd" lay-verify="title"
							autocomplete="off" placeholder="原密码" class="layui-input" readonly>
					</div>
					<span id="tishi2"></span>
				</div>
				<div id="olddiv" align="center"></div>
				<div class="layui-form-item">
					<label class="layui-form-label">新密码</label>
					<div class="layui-input-block">
						<input type="password" name="userpwd" id="userpwd" lay-verify="title"
							autocomplete="off" placeholder="新密码" class="layui-input" readnoly>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn btn-update layui-btn-danger" type="button" lay-submit=""
							lay-filter="demo1">立即修改</button>
					</div>
				</div>
			</form>
		</div>
		<!-- 影票 -->
		<div id="detailTicket" style="display: none;">
			<div class="ticket">
				<div class="ticket-position" style="background-color: white;">
			        <div class="ticket__indecator indecator--pre"><div class="indecator-text pre--text" >线上影票</div> </div>
			        <div class="ticket__inner">
			            <div class="ticket-secondary" style="background-color: white;">
			                <span class="ticket__item">票号: <strong class="ticket__number" id="ticketnum"></strong></span>
			                <span class="ticket__item ticket__date" id="playdate">2020/06/18</span>
			                <span class="ticket__item">售票: <span class="ticket__cinema">爆米花电影</span></span>
			                <span class="ticket__item">影厅: <span class="ticket__hall" id="tickethall">VIP厅</span></span>
			                <span class="ticket__item ticket__price">价格: <strong class="ticket__cost" id="ticketprice">￥20</strong></span>
			            </div>
			
			            <div class="ticket-primery" style="background-color: white;">
			                <span class="ticket__item ticket__item--primery ticket__film">片名<br><strong class="ticket__movie" id="moviename">肖申克的救赎</strong></span>
			                <span class="ticket__item ticket__item--primery">座位: <span class="ticket__place" id="seat">3排14座</span></span>
			            </div>
			        </div>
		        <div class="ticket__indecator indecator--post"><div class="indecator-text post--text">线上影票</div></div>
		    </div>
		</div>	
		</div>
		<!-- 发表影评 -->
		<div id="addComment" style="display: none;padding: 20px 100px 0 0;">
			<form class="layui-form" action="" lay-filter="example">
				<input type="hidden" id="themovieid">
				<input type="hidden" id="myscore">
				<div id="addscore" style="margin-left: 110px"></div>
				<div class="layui-form-item">
					<div class="layui-input-block">
						<textarea class="layui-textarea" id="addcomment"></textarea>
					</div>
				</div>
				
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn btn-update layui-btn-danger" type="button" lay-submit="" id="demo2">立即发布</button>
					</div>
				</div>
			</form>
		</div>
		<!-- 发表追评 -->
		<div id="addReview" style="display: none;padding: 20px 100px 0 0;">
			<form class="layui-form" action="" lay-filter="example">
				<input type="hidden" id="thecommentid">
				<div class="layui-form-item">
					<div class="layui-input-block">
						<textarea class="layui-textarea" id="addreview"></textarea>
					</div>
				</div>
				
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn btn-update layui-btn-danger" type="button" lay-submit="" id="demo3">立即发布</button>
					</div>
				</div>
			</form>
		</div>
		<!-- 展示二维码 -->
		<div id="showQRcode" style="display: none;">
			<img id="QRimg">
		</div>
		<!-- 退款 -->
		<div id="refundOrder" style="display: none;padding: 20px 10px 10px 70px;">
			<div id="refundtime"></div>
			<form name=traderefund action="alipayRefund" method="post" target="_blank" class="layui-form">
				<div id="body3" class="tab-content" name="divcontent">
					<dl class="content">
						<input id="out_trade_no" type="hidden" name="out_trade_no" />
						<input id="trade_no" type="hidden" name="trade_no" />
						<hr class="one_line">
						<dt>退款金额 ：</dt>
						<dd>
							<input id="refund" name="refund" readonly/>
						</dd>
						<hr class="one_line">
						<dt>退款原因 ：</dt>
						<dd>
							<input id="refund_cause" name="refund_cause" />
						</dd>
						<input id="refund_num" type="hidden" name="refund_num" />
						<hr class="one_line">
						<dt></dt>
						<dd id="btn-dd">
							<span class="new-btn-login-sp">
								<button class="new-btn-login" type="submit" style="text-align: center;">退 款</button>
							</span> 
							<span class="note-help">商户订单号与支付宝交易号二选一，如果您点击“退款”按钮，即表示您同意该次的执行操作。</span>
						</dd>
					</dl>
				</div>
			</form>	
		</div>
		<!-- 用来接收值 获取各种总数-->	
		<input type="hidden" id="count1" >
		<input type="hidden" id="count2" >
		<input type="hidden" id="count3" >
		<input type="hidden" id="count4" >

		<!-- Jquery Js -->
		<script src="dependencies/jquery/js/jquery.min.js"></script>
		
		<script type="text/javascript" src="js/jquerysession.js"></script>

		<!-- Bootstrap Js -->
		<script src="dependencies/bootstrap/js/bootstrap.min.js"></script>

		<!-- Site Scripts -->
		<script src="assets/js/app.js"></script>
		
		<!-- Layui Js -->
		<script src="layui/layui.js"></script>
		<!-- 获取总数 -->
		<script type="text/javascript">
			var userid = <%=session.getAttribute("userid")%>
			function getTotalOrders(){
				$.get("countOrders/"+userid,function(data){
					$("#count1").val(data);
				})
			}
			function getTotalTickets(){
				$.get("countTicketUser/"+userid,function(data){
					$("#count2").val(data);
				})	
			}
			function getTotalCollections(){
				$.get("countUserCollect/"+userid,function(data){
					$("#count3").val(data);
				})
			}
			function getTotalComments(){
				$.get("countCommentByUid/"+userid,function(data){
					$("#count4").val(data);
				})
			}
		</script>
		<!-- 初始化加载 -->
		<script type="text/javascript">
			window.addEventListener("DOMContentLoaded",function(){
				getTotalOrders();
				getTotalTickets();
				getTotalCollections();
				getTotalComments();
				/* 获取订单 */
				getOrder(1);
				/* 获取影票 */
				getTicket(1);
				/* 获取收藏 */
				getCollection(1);
				/* 获取影评 */
				getComment(1);
			})	
		</script>

		<script type="text/javascript">
		layui.use(['layer','form'], function(){ //独立版的layer无需执行这一句
			  var $ = layui.jquery, 
			  layer = layui.layer,
			  form = layui.form; //独立版的layer无需执行这一句
			  $('#layerDemo .layui-btn').on('click', function(){
				    var othis = $(this), method = othis.data('method');
				    active[method] ? active[method].call(this, othis) : '';
			  });
			  var active = {
			  	offset : function(othis){
			      	var type = othis.data('type')
			      	,text = othis.text();
			      	layer.open({
						type: 1,
						area: ['550px', '500px'],
						shade: 0.6,
						id: 'LAY_layuipro1',
						content: $("#editFormDiv"),
						end:function(){
							location.reload();
						} 
					});
			       form.render('radio');
			 	},
			}
		  	layui.form.on('radio(pwdRadio)', function(data){
		    	if(data.value == '1'){
		            $("#oldPwd").attr("readonly", false);
		            $("#userpwd").attr("readonly", false);
		    	} else {
			    	$("#oldPwd").attr("readonly", true);
			        $("#userpwd").attr("readonly", true);
		    	}
		 	});
			  
		  	layui.form.on('submit(demo1)',function(data) {
		  		var tishi = $("#tishi").html();
		  		var tishi1 = $("#tishi1").html();
		  		var tishi2 = $("#tishi2").html();
		  		console.log(tishi+","+tishi1+","+tishi2);
				if(tishi == "" && tishi1 == "" && tishi2 == ""){
					$.ajax({
						type : "post", //提交方式
						url : "updUsers", ////地址和springmvc中控制器地址一致
						data : JSON.stringify(data.field), //提交给控制器的数据
						contentType : "application/json", //提交给控制的数据 格式
						success : function(cm) {
							layer.msg(cm.msg,{
								time : 2000
							//两秒延迟
							},function() {
								if (cm.msg == "修改成功") {
									layer.closeAll();
								}
							});
						}
					});
					return false;
				}else {
					layer.msg("请确认要修改的数据格式是否正确!");
				}
			});	
		});
		
		</script>
		<!-- 个人信息  -->
		<script type="text/javascript">
			$(function(){
				var userid = <%=session.getAttribute("userid")%>
				$("#userId").val(userid);
				$.get("getUser/"+userid,function(data){
					$("#userName").val(data.username);
					$("#userTel").val(data.usertel);
					$("#un").text(data.username);
					$("#ut").html("<span>电话 :</span>"+data.usertel);
					$("#myimg").attr("src",data.userpic);
					$.session.remove("userpic");
					$.session.set("userpic",data.userpic);
					$.session.remove("username");
					$.session.set("username",data.username);
				})
				
				$.get("getMember/"+userid,function(data){
					$("#memberlevel").html(data.grades.gradename);
					$("#memberintegral").html(data.integral);
				})
				
				$("#oldPwd").blur(function(){
					$.ajax({
						url : "judgePwd",
						type : "post",
						data : {
							oldpwd : $("#oldPwd").val(),
							userid : $("#userId").val()
						},
						success : function(data){
							if(data == true){
								$("#userpwd").attr("readonly", false);
								$("#olddiv").html("");
							}else{
								$("#olddiv").html("<span style='color:red'>"+"输入的密码与原密码不同"+"</span>");
								$("#userpwd").attr("readonly", true);
								$("#userpwd").val("");
							}
						}
					})
				})
				
				//用户电话校验
				$("#userTel").blur(function(){
					var regExp2 = /^1[34578]\d{9}$/;
					var utel = $("#userTel").val();
					if(regExp2.test(utel)){
						$("#tishi").html("");
					}else{
						$("#tishi").html("电话号码格式错误!");
						$("#tishi").css("color", "red");
					}
				})
				
				//用户名格式校验
				$("#userName").blur(function(){
					var regExp1 = /^[\u4e00-\u9fa5_a-zA-Z]*$/;
					var uname1 = $("#userName").val();
					if(regExp1.test(uname1)){
						$("#tishi1").html("");
					}else{
						$("#tishi1").html("用户名只包括英文字母与汉字!");
						$("#tishi1").css("color", "red");
					}
					
				})
				
				//密码格式校验
				$("#userpwd").blur(function(){
					var regExp3 = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/;
					var upwd = $("#userpwd").val();
					if(regExp3.test(upwd)){
						$("#tishi2").html("");
					}else{
						$("#tishi2").html("密码必须包含字母和数字，且在6~18位之间!");
						$("#tishi2").css("color", "red");
					}
				})

			})
		</script>
		
		<script type="text/javascript">
			function changeTime(time){
			    if(time){
			        var oDate = new Date(time*1),
			            oYear = oDate.getFullYear(),
			            oMonth = oDate.getMonth()+1,
			            oDay = oDate.getDate(),
			            oHour = oDate.getHours(),
			            oMin = oDate.getMinutes(),
			            oSen = oDate.getSeconds(),
			            oTime = oYear +'-'+ getBz(oMonth) +'-'+ getBz(oDay) +' '+ getBz(oHour) +':'+ getBz(oMin) +':'+getBz(oSen);//拼接时间
			        return oTime;
			    }else{
		       		 return "";
			    }
			}
			//时间补零
			function getBz(num){
			    if(parseInt(num) < 10){
			        num = '0'+num;
			    }
			    return num;
			}
			
			function changeSeat(seat){
				var s1 = seat.split(',');
				var s2 = s1[0].split('_');
				var result ;
				if(s1.length > 1){
					var s3 = s1[1].split('_');
					var s21 = s2[0]+"排"+s2[1]+"座";
					var s22 = s3[0]+"排"+s3[1]+"座";
					result = s21+","+s22;
				}else{
					var s11 = s2[0]+"排"+s2[1]+"座";
					result = s11;
				}	
				return result;
			}
		</script>
		
		<!-- 分页 -->
		<script>
		window.onload=function(){
			layui.use(['laypage', 'layer','rate'], function(){
				  var laypage = layui.laypage
				  ,layer = layui.layer
				  ,rate = layui.rate;
	
				  var lay1 = laypage.render({
					elem: 'demo6'
					,count : $("#count1").val()
					,limit : 3
					,layout: ['prev', 'next','skip']
					,jump: function(obj, first){
					  if(!first){
						layer.msg('第 '+ obj.curr +' 页');
						$("#orderlist").html("");
						getOrder(obj.curr);
					  }
					},					
				  });
				  
				  var lay2 = laypage.render({
					elem: 'demo7'
					,count : $("#count3").val()
					,limit : 3
					,layout: ['prev', 'next','skip']
					,jump: function(obj, first){
					  if(!first){
						layer.msg('第 '+ obj.curr +' 页');
						$("#collectionlist").html("");
						getCollection(obj.curr);
					  }
					},					
				  });
				  
				  var lay3 = laypage.render({
					elem: 'demo8'
					,count: $("#count2").val()
					,limit: 3
					,layout: ['prev', 'next','skip']
					,jump: function(obj, first){
					  if(!first){
						layer.msg('第 '+ obj.curr +' 页');
						$("#ticketlist").html("");
						getTicket(obj.curr);
					  }
					},					
				  });
				  var lay4 = laypage.render({
					elem: 'demo9'
					,count : $("#count4").val()
					,limit : 3
					,layout: ['prev', 'next','skip']
					,jump: function(obj, first){
					  if(!first){
						layer.msg('第 '+ obj.curr +' 页');
						$("#commentlist").html("");
						getComment(obj.curr);
					  }
					},					
				 });
				  
		   });	
		}
		</script>
		<!-- 订单事件 -->
		<script type="text/javascript">
			/* 取消订单 */
			function cancelorder(orderid,moviename){
				var order = new Object;
				order.orderid = orderid;
				order.orderstatus = 0;
				layer.confirm("是否确认取消电影"+orderid+"的订单?",function(index){
					$.ajax({
						url : "updUserOrder",
						type : "post",
						data : JSON.stringify(order),
						contentType : "application/json",
						success : function(data){
							layer.msg(data.msg,{
								time : 2000
							},function(){
								if(data.code == 200){
									location.replace(location.href);
								}
							})
						}
					})
				})
			}
			/* 删除订单 */
			function delorder(orderid,moviename){
				var order = new Object;
				order.orderid = orderid;
				order.ordercondition = 0;
				layer.confirm("是否确认删除电影"+moviename+"的订单",function(index){
					$.ajax({
						url : "updUserOrder",
						type : "post",
						data : JSON.stringify(order),
						contentType : "application/json",
						success : function(data){
							if(data.code == 200){
								layer.msg("删除成功",{
									time : 2000
								},function(){
									location.replace(location.href);
								})
							}else{
								layer.msg("删除失败");
							}
							
						}
					})
				})
			}
			/* 支付订单 */
			function payorder(orderid,orderprice){
				console.log(orderid);
				console.log(orderprice);
				// 跳转到支付页面
				location.href = "http://localhost:8080/My_Popcorn/alipaySum?out_trade_no="+orderid+"&total_amount="+orderprice+"&cus="+orderid;
			}
			
			/* 订单退款 */
			function refundorder(orderid,orderprice,playtime){
				// 跳转到退款页面
				$("#out_trade_no").val(orderid);
				$("#refund").val(orderprice);
				$("#refund_num").val(orderid);

				playtime = playtime.replace(new RegExp("-","gm"),"/"); 
				var Mplaytime = (new Date(playtime)).getTime();

				// 执行？
				gettime(Mplaytime);

			}
			
			/* 重新下单 */
			function aneworder(movieid){
				console.log(movieid);
				// 跳转到电影详情页
				location.href = "http://localhost:8080/My_Popcorn/movie-page-full.jsp?movieid="+movieid;
			}

		</script>
		
		<!-- 收藏事件 -->
		<script type="text/javascript">
			function cancelCollection(collectid,moviename){
				layer.confirm("是否确认取消收藏"+moviename+"?",function(index){
					$.ajax({
						type : "DELETE",
						url : "delCollection/"+collectid,
						data : {},
						success : function(data){
							if(data.code == 200){
								layer.msg("取消成功",{
									time : 2000
								},function(){
									if(data.code == 200){
										location.reload();
									}
								})
							}else{
								layer.msg("取消失败");
							}
							
						}
					})
				})
			}
		</script>
		
		<!-- 影票事件 -->
		<script type="text/javascript">
			var userid = <%=session.getAttribute("userid")%>;
			function delTicket(ticketid,moviename){
				layer.confirm("是否确认删除电影"+moviename+"的影票?",function(index){
					$.ajax({
						type : "post",
						url : "delTicket",
						data : {
							ticketid : ticketid,
							userid : userid
						},
						success : function(data){
							layer.msg(data.msg,{
								time : 2000
							},function(){
								console.log(data.code);
								if(data.code == 200){
									location.reload();
								}
							})
						}
					})
				})
			}
			
			function showQRcode(ticketid){
				$("#QRimg").attr("src","QRimg\\"+ticketid+".jpg");
				layer.open({
					// 生成的二维码展示
					type: 1,
					area: ['340px', '350px'],
					shade: 0.6,
					id: 'LAY_layuiproQR',
					content : $("#showQRcode")
					
				})
			}
			
			function showDetail(ticketid,moviename,playtime,hall,seat,price){
				
				$("#ticketnum").text(ticketid);
				$("#moviename").text(moviename);
				$("#playdate").text(playtime);
				$("#tickethall").text(hall);
				$("#seat").text(seat);
				$("#ticketprice").text(price);
				layer.open({
					skin: 'demo-class',
					anim: 7,
		    		type: 1,
		    		area:['1000px','500px'],
					content : $("#detailTicket") ,
				})
			}
			
			function addComment(movieid,moviename){
				console.log(movieid);
				$("#themovieid").val(movieid);
				layer.open({
					type: 1,
					area: ['600px', '330px'],
					shade: 0.6,
					title : moviename,
					id: 'LAY_layuipro2',
					content : $("#addComment")
				})
			}
		
		</script>
		
		<!-- 影评事件 -->
		<script type="text/javascript">
			var userid = <%=session.getAttribute("userid")%>
			function delComment(commentid,reviewid){
				var comment = new Object;
				comment.users = {userid : userid};
				comment.commentid = commentid;
				comment.reviewid = reviewid;
				
				// 删除影评的同时删除追评
				layer.confirm("确定要删除这条影评吗?如果有追评的话会被同时删除!",function(index){
					$.ajax({
						type : "post",
						url : "delCommentByUid",
						data : JSON.stringify(comment),
						contentType : "application/json",
						success : function(data){
							layer.msg(data.msg,{
								time : 2000
							},function(){
								if(data.code == 200){
									location.reload();
								}
							})
						},
						dataType : "json"
					})
				})
			}
			
			function delReview(reviewid){
				 layer.confirm("确定要删除这条追评吗?",function(index){
					$.ajax({
						type : "post",
						url : "delReviewByUid",
						data : {
							reviewid : reviewid,
							userid : userid
						},
						success : function(data){
							console.log(data.code);
							layer.msg(data.msg,{
								time : 2000
							},function(){
								if(data.code == 200){
									location.reload();
								}
							})
						},
						dataType : "json"
					})
				}) 
			}
			
			function addReview(commentid,moviename){
				console.log(commentid);
				$("#thecommentid").val(commentid);
				layer.open({
					type: 1,
					area: ['600px', '300px'],
					shade: 0.6,
					title : moviename,
					id: 'LAY_layuipro2',
					content : $("#addReview")
				})
			}
		</script>
		<!-- 具体获取列表方法 -->
		<script type="text/javascript">
		var userid = <%=session.getAttribute("userid")%>
		function getOrder(page){
			$.get("getOrders/"+userid+"?page="+page,function(data){
				if(data == ""){
					
				}
				$.each(data,function(i,o){
					// 下单时间
					o.ordertime = changeTime(o.ordertime);
					// 支付时间
					o.paytime = changeTime(o.paytime);
					// 开场时间
					o.schedule.playtime = changeTime(o.schedule.playtime);
					// 座位
					o.seat = changeSeat(o.seat);
					if(o.orderstatus == 2){
						o.orderstatus = "待支付";
						$("#orderlist").append("<div class='list-view-layout1'>"+
								"<div class='product-box-layout3'>"+
								"<div class='item-img'>"+
								"<a href='movie-page-full.jsp?movieid="+o.movieid+"'><img src="+o.moviepic+" alt='Product' width='135px'></a>"+
								"</div><div class='product-info'><div class='item-content'>"+
								"<h3 class='item-title'><a href='#'>"+o.moviename+"</a><span>New</span></h3>"+
								"<ul class='entry-meta'><li><i class='far fa-clock'></i>下单时间 : "+o.ordertime+"</li>"+
								"<li><i class='fas fa-map-marker-alt'></i> 影厅 : "+o.hallname+" | 座位 : "+o.seat+"</li>"+
								"<li><i class='far fa-eye'></i>开场时间 : "+o.schedule.playtime+"</li></ul>"+
								"<ul class='item-condition'><li><span>状态 : </span>"+o.orderstatus+"</li></ul>"+
								"</div><div class='item-right'><div style='height:130px;'></div>"+
								"<div class='item-price'><span class='currency-symbol'>$</span>"+o.orderprice+"</div>"+
								"<div class='item-btn'>"+
								"<a href='javascript:;' onclick='payorder("+o.orderid+","+o.orderprice+")'>去支付</a> <a href='javascript:;' onclick='cancelorder(\""+o.orderid+"\",\""+o.moviename+"\")'>取消订单</a>"+
								"</div></div></div></div></div>");
					}else if(o.orderstatus == 1){
						o.orderstatus = "已支付";
						$("#orderlist").append("<div class='list-view-layout1'>"+
								"<div class='product-box-layout3'>"+
								"<div class='item-img'>"+
								"<a href='movie-page-full.jsp?movieid="+o.movieid+"'><img src="+o.moviepic+" alt='Product' width='135px'></a>"+
								"</div><div class='product-info'><div class='item-content'>"+
								"<h3 class='item-title'><a href='#'>"+o.moviename+"</a></h3>"+
								"<ul class='entry-meta'><li><i class='far fa-clock'></i>下单时间 :"+o.ordertime+"</li>"+
								"<li><i class='fas fa-map-marker-alt'></i> 影厅 :"+o.hallname+" | 座位 : "+o.seat+"</li>"+
								"<li><i class='far fa-eye'></i>开场时间 : "+o.schedule.playtime+"</li>"+
								"<li><i class='far fa-clock'></i>支付时间 : "+o.paytime+"</li></ul>"+
								"<ul class='item-condition'><li><span>状态:</span>"+o.orderstatus+"</li></ul>"+
								"</div><div class='item-right'><div style='height: 130px;'></div>"+
								"<div class='item-price'><span class='currency-symbol'>$</span>"+o.orderprice+"</div>"+
								"<div class='item-btn'><a href='javascript:;' onclick='delorder(\""+o.orderid+"\",\""+o.moviename+"\")'>删除订单</a>"+
								" <a href='javascript:;' onclick='refundorder(\""+o.orderid+"\",\""+o.orderprice+"\",\""+o.schedule.playtime+"\")'>申请退款</a></div></div></div></div></div>");	
					}else if(o.orderstatus == 0){
						o.orderstatus = "已取消";
						$("#orderlist").append("<div class='list-view-layout1'>"+
								"<div class='product-box-layout3'>"+
								"<div class='item-img'>"+
								"<a href='movie-page-full.jsp?movieid="+o.movieid+"'><img src="+o.moviepic+" alt='Product' width='135px'></a>"+
								"</div><div class='product-info'><div class='item-content'>"+
								"<h3 class='item-title'><a href='#'>"+o.moviename+"</a></h3>"+
								"<ul class='entry-meta'><li><i class='far fa-clock'></i>下单时间 :"+o.ordertime+"</li>"+
								"<li><i class='fas fa-map-marker-alt'></i> 影厅 :"+o.hallname+" | 座位 : "+o.seat+"</li>"+
								"<li><i class='far fa-eye'></i>开场时间 :"+o.schedule.playtime+" </li></ul>"+
								"<ul class='item-condition'><li><span>状态:</span>"+o.orderstatus+"</li></ul></div>"+
								"<div class='item-right'><div style='height: 130px;'></div>"+
								"<div class='item-price'><span class='currency-symbol'>$</span>"+o.orderprice+"</div>"+
								"<div class='item-btn'><a href='javascript:;' onclick='aneworder(\""+o.movieid+"\")'>重新下单</a>"+
								" <a href='javascript:;' onclick='delorder(\""+o.orderid+"\",\""+o.moviename+"\")'>删除订单</a></div></div></div></div></div>");
					}else if(o.orderstatus == 3){
						o.orderstatus = "已退款";
						$("#orderlist").append("<div class='list-view-layout1'>"+
								"<div class='product-box-layout3'>"+
								"<div class='item-img'>"+
								"<a href='movie-page-full.jsp?movieid="+o.movieid+"'><img src="+o.moviepic+" alt='Product' width='135px'></a>"+
								"</div><div class='product-info'><div class='item-content'>"+
								"<h3 class='item-title'><a href='#'>"+o.moviename+"</a></h3>"+
								"<ul class='entry-meta'><li><i class='far fa-clock'></i>下单时间 :"+o.ordertime+"</li>"+
								"<li><i class='fas fa-map-marker-alt'></i> 影厅 :"+o.hallname+" | 座位 : "+o.seat+"</li>"+
								"<li><i class='far fa-eye'></i>开场时间 :"+o.schedule.playtime+" </li></ul>"+
								"<ul class='item-condition'><li><span>状态:</span>"+o.orderstatus+"</li></ul></div>"+
								"<div class='item-right'><div style='height: 130px;'></div>"+
								"<div class='item-price'><span class='currency-symbol'>$</span>"+o.orderprice+"</div>"+
								"<div class='item-btn'><a href='javascript:;' onclick='aneworder(\""+o.movieid+"\")'>重新下单</a>"+
								" <a href='javascript:;' onclick='delorder(\""+o.orderid+"\",\""+o.moviename+"\")'>删除订单</a></div></div></div></div></div>");
					}
				})
			})
		}
		
		function getTicket(page){
		$.get("getCommentByUid/"+userid,function(data2){
			$.get("getDoubleOrder/"+userid,function(data1){
				$.get("selTicketUser/"+userid+"?page="+page,function(data){
					$.each(data,function(i,o){		
						var commented;
						$.each(data1,function(z,x){
							if(o.orders.orderid == x){
								o.orders.orderprice = o.orders.orderprice/2;
							}
						})
						$.each(data2,function(t,y){
							if(y.movies.movieid == o.movieid){
								commented = 1;
							}
						})
						// 开场时间
						o.playtime = changeTime(o.playtime);
						if(o.ticketstatus == 1){
						   o.ticketstatus = "已取票";
						}else if(o.ticketstatus == 0){
						   o.ticketstatus = "待取票";
						}else if(o.ticketstatus == 2){
						   o.ticketstatus = "已放映";
						}else if(o.ticketstatus == 3){
						   o.ticketstatus = "已退票";
						}
						o.seat = changeSeat(o.seat);
						if(o.ticketstatus == "已放映" && commented != 1){
							$("#ticketlist").append("<div class='list-view-layout1'>"+
									"<div class='product-box-layout3'>"+
									"<div class='item-img'><a href='movie-page-full.jsp?movieid="+o.movieid+"'><img src='"+o.moviepic+"' alt='Product' width='100px'></a>"+
									"</div><div class='product-info'><div class='item-content'>"+
									"<h3 class='item-title'><a href='#'>"+o.moviename+"</a></h3>"+
									"<ul class='entry-meta'><li><i class='far fa-clock'></i>开场时间 : "+o.playtime+"</li>"+
									"<li><i class='fas fa-map-marker-alt'></i>影厅 : "+o.hallname+"</li>"+
									"<li><i class='far fa-eye'></i>座位 : "+o.seat+"</li></ul>"+
									"<ul class='item-condition'><li><span>状态:</span>"+o.ticketstatus+"</li>"+
									"<li><span>票价:$</span>"+o.orders.orderprice+"</li></ul>"+
									"<div class='btn-group'><a href='javascript:;' onclick='delTicket(\""+o.ticketid+"\",\""+o.moviename+"\")'>删除影票</a>"+
									" <a href='javascript:;' onclick='showQRcode("+o.ticketid+")'>查看二维码</a>"+
									" <a href='javascript:;' onclick='showDetail(\""+o.ticketid+"\",\""+o.moviename+"\",\""+o.playtime+"\",\""+o.hallname+"\",\""+o.seat+"\",\""+o.orders.orderprice+"\")'>影票详情</a>"+
									" <a href='javascript:;' onclick='addComment(\""+o.movieid+"\",\""+o.moviename+"\")'>发布影评</a></div></div></div></div></div>");
						}else if(o.ticketstatus == "已放映" && commented == 1){
							$("#ticketlist").append("<div class='list-view-layout1'>"+
									"<div class='product-box-layout3'>"+
									"<div class='item-img'><a href='movie-page-full.jsp?movieid="+o.movieid+"'><img src='"+o.moviepic+"' alt='Product' width='100px'></a>"+
									"</div><div class='product-info'><div class='item-content'>"+
									"<h3 class='item-title'><a href='#'>"+o.moviename+"</a></h3>"+
									"<ul class='entry-meta'><li><i class='far fa-clock'></i>开场时间 : "+o.playtime+"</li>"+
									"<li><i class='fas fa-map-marker-alt'></i>影厅 : "+o.hallname+"</li>"+
									"<li><i class='far fa-eye'></i>座位 : "+o.seat+"</li></ul>"+
									"<ul class='item-condition'><li><span>状态:</span>"+o.ticketstatus+"</li>"+
									"<li><span>票价:$</span>"+o.orders.orderprice+"</li></ul>"+
									"<div class='btn-group'><a href='javascript:;' onclick='delTicket(\""+o.ticketid+"\",\""+o.moviename+"\")'>删除影票</a>"+
									" <a href='javascript:;' onclick='showQRcode("+o.ticketid+")'>查看二维码</a>"+
									" <a href='javascript:;' onclick='showDetail(\""+o.ticketid+"\",\""+o.moviename+"\",\""+o.playtime+"\",\""+o.hallname+"\",\""+o.seat+"\",\""+o.orders.orderprice+"\")'>影票详情</a>"+
									" <a href='#'>已发影评</a></div></div></div></div></div>");
						}else {
							$("#ticketlist").append("<div class='list-view-layout1'>"+
									"<div class='product-box-layout3'>"+
									"<div class='item-img'><a href='movie-page-full.jsp?movieid="+o.movieid+"'><img src='"+o.moviepic+"' alt='Product' width='100px'></a>"+
									"</div><div class='product-info'><div class='item-content'>"+
									"<h3 class='item-title'><a href='#'>"+o.moviename+"</a></h3>"+
									"<ul class='entry-meta'><li><i class='far fa-clock'></i>开场时间 : "+o.playtime+"</li>"+
									"<li><i class='fas fa-map-marker-alt'></i>影厅 : "+o.hallname+"</li>"+
									"<li><i class='far fa-eye'></i>座位 : "+o.seat+"</li></ul>"+
									"<ul class='item-condition'><li><span>状态:</span>"+o.ticketstatus+"</li>"+
									"<li><span>票价:$</span>"+o.orders.orderprice+"</li></ul>"+
									"<div class='btn-group'><a href='javascript:;' onclick='delTicket(\""+o.ticketid+"\",\""+o.moviename+"\")'>删除影票</a>"+
									" <a href='javascript:;' onclick='showQRcode("+o.ticketid+")'>查看二维码</a>"+
									" <a href='javascript:;' onclick='showDetail(\""+o.ticketid+"\",\""+o.moviename+"\",\""+o.playtime+"\",\""+o.hallname+"\",\""+o.seat+"\",\""+o.orders.orderprice+"\")'>影票详情</a>"+
									" </div></div></div></div></div>");
						}
					})
				  })
			   })
			})
		}
		
		function getCollection(page){
			$.get("getUserCollect/"+userid+"?page="+page,function(data){
				$.each(data,function(i,o){
					o.movies.releasedate = changeTime(o.movies.releasedate);
					if(o.movies.moviestatus == 1){
						o.movies.moviestatus = "有场次";
					}else{
						o.movies.moviestatus = "无场次";
					}
					$("#collectionlist").append("<div class='list-view-layout1'>"+
							"<div class='product-box-layout3'>"+
							"<div class='item-img'><a href='movie-page-full.jsp?movieid="+o.movieid+"'>"+
							"<img src='"+o.movies.moviepicture+"' alt='Product' width='100px'></a></div>"+
							"<div class='product-info'><div class='item-content'>"+
							"<h3 class='item-title'><a href='#'>"+o.movies.moviename+"</a></h3>"+
							"<ul class='entry-meta'><li><i class='far fa-clock'></i>上映时间 : "+o.movies.releasedate+"</li><br/>"+
							"<li><i class='fas fa-map-marker-alt'></i>国家 : "+o.movies.place+"</li>"+
							"<li><i class='far fa-eye'></i>语言 : "+o.movies.language+"</li></ul>"+
							"<ul class='item-condition'><li><span>状态 :</span>"+o.movies.moviestatus+"</li></ul>"+
							"</div><div class='item-right'><div style='height: 115px;'></div>"+
							"<div class='item-btn'><a href='javascript:;' onclick='cancelCollection(\""+o.collectid+"\",\""+o.movies.moviename+"\")'>取消收藏</a></div>"+
							"</div></div></div></div>");
				})
			})
			
		}
		
		function getComment(page){
			$.get("getCommentByUid/"+userid+"?page="+page,function(data){
				console.log(data);
				$.each(data,function(i,o){
					console.log(o.reviewstatus);
					o.commenttime = changeTime(o.commenttime);
					o.reviewtime = changeTime(o.reviewtime);
					if(o.reviewid == null || o.reviewstatus == 0){
						console.log("add");
						$("#commentlist").append("<div class='list-view-layout1'>"+
								"<div class='product-box-layout3'>"+
								"<div class='item-img'><a href='movie-page-full.jsp?movieid="+o.movieid+"'><img src='"+o.movies.moviepicture+"' alt='Product' width='135px'></a>"+
								"</div><div class='product-info'><div class='item-content'>"+
								"<h3 class='item-title'><a href='#'>"+o.movies.moviename+"</a></h3>"+
								"<ul class='item-condition'><li><span>我的评分 :</span></li></ul><div id='comment"+o.commentid+"'></div>"+
								"<div></div><ul class='entry-meta'><li><i class='far fa-clock'></i>评价时间 : "+o.commenttime+"</li>"+
								"<br/><li><span>评价内容:</span>"+o.content+"</li></ul></div>"+
								"<div class='item-right'><div style='height: 160px;'></div>"+
								"<div class='item-price'><span class='currency-symbol'></span></div>"+
								"<div class='item-btn'><a href='javascript:;' onclick='delComment("+o.commentid+","+o.reviewid+")'>删除影评</a>"+
								" <a href='javascript:;' onclick='addReview(\""+o.commentid+"\",\""+o.movies.moviename+"\")'>发布追评</a></div></div></div></div></div>");
					}else if(o.reviewstatus == 1){
						$("#commentlist").append("<div class='list-view-layout1'>"+
								"<div class='product-box-layout3'>"+
								"<div class='item-img'><a href='movie-page-full.jsp?movieid="+o.movieid+"'><img src='"+o.movies.moviepicture+"' alt='Product' width='135px'></a>"+
								"</div><div class='product-info'><div class='item-content'>"+
								"<h3 class='item-title'><a href='#'>"+o.movies.moviename+"</a></h3>"+
								"<ul class='item-condition'><li><span>我的评分 :</span></li></ul><div id='comment"+o.commentid+"'></div>"+
								"<ul class='entry-meta'><li><i class='far fa-clock'></i>评价时间 : "+o.commenttime+"</li>"+
								"<br/><li><span>评价内容:</span>"+o.content+"</li><br/><li><i class='far fa-clock'></i>"+
								"追评时间 : "+o.reviewtime+"</li><br/><li><span>追评内容:</span>"+o.reviewcontent+"</li></ul></div>"+
								"<div class='item-right'><div style='height: 160px;'></div>"+
								"<div class='item-price'><span class='currency-symbol'></span></div>"+
								"<div class='item-btn'><a href='javascript:;' onclick='delReview("+o.reviewid+")'>删除追评</a>"+
								" <a href='javascript:;' onclick='delComment("+o.commentid+","+o.reviewid+")'>删除影评</a>"+
								"</div></div></div></div></div>");
					}
					
					//给星星赋值
					layui.use(['rate'], function(){
						  var rate = layui.rate;
						  rate.render({
						    elem: '#comment'+o.commentid
						    ,value: o.score
						    ,half: true //开启半星
						    ,readonly: true
						  });
					});
			   })				
			})
		}
		</script>
		
		<script type="text/javascript">
			//给星星赋值
			layui.use(['rate'], function(){
				  var rate = layui.rate;
				  rate.render({
				    elem: '#addscore'
				    ,value: 0
				    ,half: true //开启半星
				    ,choose : function(value){
				    	$("#myscore").val(value);
				    }
				  });
			});
		
		</script>
		
		<script type="text/javascript">
			var userid = <%=session.getAttribute("userid")%>
			$("#demo2").click(function(){
				var moviecomment = new Object;
				moviecomment.content = $("#addcomment").val();
				moviecomment.score = $("#myscore").val();
				moviecomment.movies = {movieid : $("#themovieid").val()};
				moviecomment.users = {userid : userid};
				$.ajax({
					type : "post",
					url : "addComment",
					data : JSON.stringify(moviecomment),
					contentType : "application/json",
					success : function(data){
						layer.msg(data.msg,{
							time : 2000
						},function(){
							if(data.code == 200){
								location.reload();
							}
						})
					},
					dataType : "json"
				})
			})
			
			$("#demo3").click(function(){
				var reviewcomment = new Object;
				reviewcomment.comment = {commentid : $("#thecommentid").val()};
				reviewcomment.reviewcontent = $("#addreview").val();
				$.ajax({
					type : "post",
					url : "addreview",
					data : JSON.stringify(reviewcomment),
					contentType : "application/json",
					success : function(data){
						layer.msg(data.msg,{
							time : 2000
						},function(){
							if(data.code == 200){
								console.log(data.code);
								location.reload();
							}
						})
					},
					dataType : "json"
				})
			})
		
		</script>
		
		<script>
			//电影开始时间之前一天是否可以退款的倒计时
			function gettime(moviesStartDate) { 
				//当前时间
				var now = new Date();
				//最后电影开始时间提前一天不能退款
				var end = new Date(moviesStartDate - 24 * 60 * 60 * 1000);
				console.log("now:"+now);
				console.log("end:"+end);
			
				/*两个时间相减,得到的是毫秒ms,变成秒*/
				var result = Math.floor(end - now) / 1000; //result= 30*60s;
				var interval = setInterval(sub, 1000); //定时器 调度对象
				/*封装减1秒的函数*/
				function sub() {
					//得到的result意思就是距离电影开始时间（提前一天的时间）
					if (result > 1) {
						result = result - 1;

						var second = Math.floor(result % 60); // 计算秒 ，取余
						var minite = Math.floor((result / 60) % 60); //计算分 ，换算有多少分，取余，余出多少秒
						var hour = Math.floor(result/60/60%24);  //计算小时，
						var day = Math.floor(result/60/60/24);   //计算天，
						$("#refundtime").html("可以退款的剩余时间：" +day + "天" + hour + "时" + minite + "分" + second + "秒");

						layer.open({
							type: 1,
							area: ['500px', '400px'],
							shade: 0.6,
							id: 'LAY_layuiproRefund',
							content : $("#refundOrder"),
							end:function(){
								location.reload()
							} 
						})
					} else {
						//这里可以添加倒计时结束后需要执行的事件
						alert("时间超过，不能退款");
						window.clearInterval(interval);
					}
				};
			}
		
	</script>
	
	 <input type="hidden" id="refundstatus" value="${trade_status}">
	 <input type="hidden" id="refundorderid" value="${orderid}">
	
	<script type="text/javascript">
		// 退款后返回到个人中心页面进行判断 并修改订单和影票状态
		$(function(){
			console.log($("#refundstatus").val());
			if($("#refundstatus").val() == "退款成功"){
				// 修改订单状态为已退款 -- 同时删除影票信息
				var refundorderid = $("#refundorderid").val();
				console.log("退款");
				console.log(refundorderid);
				$.get("refundsuccess/"+refundorderid,function(data){
					console.log("退款信息修改中...")
					if(data == 1){
						alert("退款成功");
						location.href = "http://localhost:8080/My_Popcorn/account.jsp";
					}else{
						alert("退款失败");
						location.href = "http://localhost:8080/My_Popcorn/account.jsp";
					}
				})
			}
		})
	</script>
	
	<script type="text/javascript">
		function updimg(){
			layer.open({
				// 修改头像
				type: 1,
				area: ['250px', '355px'],
				shade: 0.6,
				id: 'LAY_layuiproIMG',
				title : '修改头像',
				content : $("#upduserimg")
			})
		}
	</script>
	
	<script type="text/javascript">
	
		layui.use('upload', function(){
		  var $ = layui.jquery
		  ,upload = layui.upload;
		  
		 //普通图片上传
		 var uploadInst = upload.render({
			elem : '#test1',
			url : 'upduserimg' //改成您自己的上传接口
			,
			accept : 'image',
			field : 'uploadPic',
			auto : false,
			bindAction : '#confirmupd',
			xhr : xhrOnProgress,
			progress : function(value) {//上传进度回调 value进度值
				console.log("进度" + value);
			},
			before : function(obj) {
				this.data = {
					userid : userid
				}
			},
			choose : function(obj) {
				//预读本地文件示例，不支持ie8
				obj.preview(function(index,file, result) {
					$('#demo1').attr('src',result); //图片链接（base64）
				});
			},
			done : function(data) {
				//如果上传失败
				layer.msg(data.msg);
				if (data.code == 200) {
					setTimeout(function() {
						location.replace(location.href);
					}, 1000);
				}
				//上传成功
			},
			error : function() {
				//演示失败状态，并实现重传
				var demoText = $('#demoText');
				demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
				demoText.find('.demo-reload').on('click', function() {uploadInst.upload();});
			}
		 });
	   })
	
	</script>
	
	<!-- 修改头像 -->
	<div id="upduserimg" style="display: none;padding:20px 0px 0px 50px">
		<div class="layui-upload">
		  <button type="button" class="layui-btn layui-btn-danger" id="test1">上传图片</button>
			  <div class="layui-upload-list">
			    <img class="layui-upload-img" id="demo1" width="150px" height="150px">
			    <p id="demoText"></p>
			  </div>
		  <button type="button" class="layui-btn layui-btn-danger" id="confirmupd">修改</button>
		</div>
	</div>
		
	

  </body>

</html>
